package com.juyu.miliao.authentication.dao.mysql;

import com.juyu.miliao.authentication.domain.Version;
import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @Auther: 卜加超
 * @Date: 2019/4/3 10:36
 * @Description:
 */
@Component
public class VersionHistoryDao {
    @Resource
    private SqlSession sqlSession;
    public Version getLastForceUpdatingVersion(int phoneSystem, String appPackageId) {
        Map<String, Object> map = new HashMap<>(4);
        map.put("phoneSystem", phoneSystem);
        map.put("appPackageId", appPackageId);
        return sqlSession.selectOne("getLastForceUpdatingVersion", map);
    }

    public Version getNewestVersion(int phoneSystem, String appPackageId) {
        Map<String, Object> map = new HashMap<>(4);
        map.put("phoneSystem", phoneSystem);
        map.put("appPackageId", appPackageId);
        return sqlSession.selectOne("getNewestVersion", map);
    }
}
